'use strict';
module.exports = app => {
  const { INTEGER } = app.Sequelize;

  const UserRole = app.model.define('user_role', {
    id: { type: INTEGER, primaryKey: true, autoIncrement: true },
    user_id: { type: INTEGER(11) },
    role_id: { type: INTEGER(11) },
  });
  UserRole.associate = () => {
    app.model.UserRole.belongsTo(app.model.Role, {
      foreignKey: 'role_id',
      targetKey: 'id',
    });
  };

  return UserRole;
};
